function swap<T, U>(tuple: [T, U]): [U, T] {
  return [tuple[1], tuple[0]];
}
console.log(swap<number, string>([1, "2"]));

// 泛型约束
interface LengthType {
    length:number
}
function getLength<T extends LengthType >(a:T):T{
    console.log(a.length)
    return a
}

export {};
